//
//  evaluationCell.m
//  jiaKaoZhuShou
//
//  Created by 金艺社 on 2018/5/17.
//  Copyright © 2018年 金艺社. All rights reserved.
//

#import "evaluationCell.h"

@implementation evaluationCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(evaluationModel *)model {
    _model = model;
    self.phone_lab.text = _model.phone;
    self.evaluation_lab.text = _model.apprais;
    self.time_lab.text = [NSString ConvertStrToTime:_model.creatDate];
    [self start:_model.start];
}

- (void)start:(NSNumber *)number {
    //float f = 1.6; int a; a = floor(f); NSLog("a = %d",a);
    float a = number.floatValue;
    int b = floor(a);//整个星
    float c = a - b;//半个星
    NSArray *subViews = [self.contentView subviews];
    for (UIView *V in subViews) {
        if ([V isKindOfClass:[UIImageView class]] && V.tag == 110) {
            UIImageView *imgView = (UIImageView *)V;
            imgView.image = [UIImage imageNamed:@"greaStars"];
            if (b > 0) {
                imgView.image = [UIImage imageNamed:@"yellowStars"];
                b--;
            }else if (c > 0) {
                imgView.image = [UIImage imageNamed:@"halfStars"];
                c = 0.0;
            }
        }
    }
}
@end
